﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using System.Xml.Linq;
using System.Xml;

namespace BlueRoseGames.Controls.Text
{
    public class Font
    {
        public Dictionary<int, Glyph> Glyphs
        {
            get;
            set;
        }

        public double Height
        {
            get;
            set;
        }

        public double PointSize
        {
            get;
            set;
        }

        public double Baseline
        {
            get;
            set;
        }

        public Font(string fontUri)
        {
            XDocument doc = XDocument.Load(fontUri);
            Glyphs = new Dictionary<int, Glyph>();
            Height = double.Parse(doc.Root.Attribute("height").Value);
            PointSize = double.Parse(doc.Root.Attribute("pointSize").Value);
            Baseline = double.Parse(doc.Root.Attribute("baseline").Value);
            foreach (XElement ele in doc.Root.Elements())
            {
                Glyph g = new Glyph(ele);
                Glyphs.Add(g.Key, g);
            }
        }
    }
}
